﻿@model Kongt.Model.Custom.TotalReportModel
@{
    var Query = (Kongt.IServices.QueryModel.TotalReportQuery)ViewBag.p;
    PagedList<ChargeInfo> pmodel = (PagedList<ChargeInfo>)ViewBag.pmodel;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="/css/style.css" rel="stylesheet" type="text/css" />
    <link href="/css/select.css" rel="stylesheet" type="text/css" />
    <link href="/css/aggregateinfo.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/js/jquery.js"></script>
    <script type="text/javascript" src="/js/jquery.idTabs.min.js"></script>
    <script type="text/javascript" src="/js/select-ui.min.js"></script>

    <script type="text/javascript">
        KE.show({
            id: 'content7',
            cssPath: './index.css'
        });
    </script>

    <script type="text/javascript">
        $(document).ready(function (e) {
            var firstArea = '@(Query?.FirstArea)';
            var secondArea = '@(Query?.SecondArea)';
            var dateStart = '@(Query?.dateStart?.ToString("yyyy/MM/dd"))';
            var dateEnd = '@(Query?.dateEnd?.ToString("yyyy/MM/dd"))';

            $('#ul1').find("select[name='dateStart']").find("option:first").before("<option value=''>请选择</option>");
            if (dateStart) {
                $('#ul1').find("select[name='dateStart']").find("option[value='"+dateStart+"']").attr("selected", true);
            }
            else {
                $('#ul1').find("select[name='dateStart']").find("option:first").attr("selected", true);
            }
          
            $('#ul1').find("select[name='dateStart']").prev().find("em:first").text($('#ul1').find("select[name='dateStart']").find("option:selected").text());

            $('#ul1').find("select[name='dateEnd']").find("option:first").before("<option value=''>请选择</option>");
            if (dateEnd) {
                $('#ul1').find("select[name='dateEnd']").find("option[value='" + dateEnd + "']").attr("selected", true);
            }
            else {
                $('#ul1').find("select[name='dateEnd']").find("option:first").attr("selected", true);
            }
            $('#ul1').find("select[name='dateEnd']").prev().find("em:first").text($('#ul1').find("select[name='dateEnd']").find("option:selected").text());

             
            $('#ul1').find("select[name='FirstArea']").find("option:first").before("<option value=''>请选择</option>");
            if (secondArea) {
                $('#ul1').find("select[name='FirstArea']").attr('secondArea', secondArea);
            } 
            if (firstArea) {
                $('#ul1').find("select[name='FirstArea']").find("option[value='" + firstArea + "']").attr("selected", true);
                $('#ul1').find("select[name='FirstArea']").trigger("change");
            }
            else {
                $('#ul1').find("select[name='FirstArea']").find("option:first").attr("selected", true);
            } 
            $('#ul1').find("select[name='FirstArea']").prev().find("em:first").text($('#ul1').find("select[name='FirstArea']").find("option:selected").text());


            $(".select1").uedSelect({
                width: 345
            });
            $(".select2").uedSelect({
                width: 167
            });
            $(".select3").uedSelect({
                width: 150
            });
        });
    </script>
</head>

<body>

    <div class="place">
        <span>位置：</span>
        <ul class="placeul">
            <li><a href="#">首页</a></li>
            <li><a href="#">数据统计管理</a></li>
            <li><a href="#">汇总统计</a></li>
        </ul>
    </div>

    <div class="formbodycharge">

        <!--汇总查询-->
        <div class="userinfocharge">
            选择汇总统计条件
        </div>
        <div id="tab2" class="tabsoncharge">
            <form method="post">
                <ul class="seachformcharge" id="ul1">


                    @Html.Action("_LinkArea", "Common")
                    <li>
                        <label>起始日期</label>
                        <div class="vocation">
                            <select class="select3" name="dateStart">
                                @{
                                    var date = DateTime.Now.AddMonths(-6);
                                    var startDate = new DateTime(date.Year, date.Month, 1);
                                    while (startDate < DateTime.Now.AddMonths(1))
                                    {
                                        <option value="@(startDate.ToString("yyyy/MM/dd"))">@(startDate.Year)年@(startDate.Month)月@(startDate.Day)日</option>
                                        startDate = startDate.AddDays(15);
                                    }
                                }
                            </select>
                        </div>
                    </li>

                    <li>
                        <label>结束日期</label>
                        <div class="vocation">
                            <select class="select3" name="dateEnd">
                                @{
                                    var date1 = DateTime.Now.AddMonths(-6);
                                    var startDate1 = new DateTime(date1.Year, date1.Month, 1);
                                    while (startDate1 < DateTime.Now.AddMonths(1))
                                    {
                                        <option value="@(startDate1.ToString("yyyy/MM/dd"))">@(startDate1.Year)年@(startDate1.Month)月@(startDate1.Day)日</option>
                                        startDate1 = startDate1.AddDays(15);
                                    }
                                }
                            </select>
                        </div>
                    </li>

                    <li>
                        <label>&nbsp;</label>
                        <input name="" type="submit" class="scbtn" value="查询" />
                    </li>
                </ul>
            </form>
            <!--汇总查询结束-->

            <div class="userinfocharge2">
                汇总统计信息
            </div>
            <div id="tab2" class="tabson">


                <ul class="seachformchargesf">
                    <li><label><a href="#">水费金额:</a></label><font color="ff0000"><input type="text" value="@(Model.TotalWaterPrice.ToString("f2"))" class="scinputchargesfred" disabled="disabled" style="background:#EFEFEF" /></font></li>
                    <li><label><a href="#">待收余额:</a></label><input type="text" value="@(Model.AmountBeReceived.ToString("f2"))" class="scinputchargesf" disabled="disabled" style="background:#EFEFEF" /></li>
                    <li><label>滞纳金额: </label><input type="text" value="@(Model.TotalLateFee.ToString("f2"))" class="scinputchargesf" disabled="disabled" style="background:#EFEFEF" /></li>
                    <li><label><a href="#">水费欠收:</a></label><input type="text" value="@(Model.WaterPriceBeReceived.ToString("f2"))" class="scinputchargesfred" disabled="disabled" style="background:#EFEFEF" /></li>
                    <li><label>合计方数:</label><input type="text" value="@(Model.WaterMuch)" class="scinputchargesf" disabled="disabled" style="background:#EFEFEF" /></li>
                    <li><label>待收方数:</label><font color="ff0000"><input type="text" value="@(Model.WaterMuchBeReceived)" class="scinputchargesf" disabled="disabled" style="background:#EFEFEF" /></font></li>
                    <li><label>合计户数:</label><input type="text" value="@(Model.TotalCustomerCount)" class="scinputchargesf" disabled="disabled" style="background:#EFEFEF" /></li>
                    <li><label>待收户数: </label><input type="text" value="@(Model.TotalCustomerCountBeReceived)" class="scinputchargesf" disabled="disabled" style="background:#EFEFEF" /></li>
                    <li><font color="ff0000"><label>实收合计: </label></font><input type="text" value="@(Model.HasColectTotal.ToString("f2"))" class="scinputchargesfred" disabled="disabled" style="background:#EFEFEF" /></li>
                    <li><label><font color="ff0000">注：点击水费金额、待收余额、水费欠收查询详细信息。 </font></label></li>

                </ul>
            </div>


            <table class="tablelistcharge">
                <thead>
                    <tr> 
                        <th>用户编号</th>
                        <th>用户姓名</th>
                        <th>区域分布</th>
                        <th>区域名称</th>
                        <th>详细地址</th>
                        <th>用水类别</th>
                        <th>上期底数</th>
                        <th>本期底数</th>
                        <th>用水量</th>
                        <th>单价</th>
                        <th>水费金额</th>
                        <th>滞纳金</th>
                        <th>应收金额</th>
                        <th>收费状态</th>
                        @*<th>预付余额</th>
                            <th>收款金额</th>
                            <th>本次找零</th>*@

                        <th>收费人员</th>
                        <th>收费日期</th>
                        <th>抄表人员</th>
                        <th>抄表日期</th>
                    </tr>
                </thead>
                <tbody>
                    @if (pmodel?.TotalItemCount > 0)
                    {
                        foreach (var item in pmodel)
                        {
                            <tr> 
                                <td>@(item.Customer.CustomerId)</td>
                                <td height="30px;">@(item.Customer.CustomerName)</td>
                                <td><a href="#">@(item.Customer.FirstArea)</a></td>
                                <td>@(item.Customer.SecondArea)</td>
                                <td>@(item.Customer.DetailAddress)</td>
                                <td>@(item.Customer.WaterType.TypeName)</td>
                                <td>@(item?.LastMeterShow)</td>
                                <td>@(item?.ThisMeterShow)</td>
                                <td>@(item?.WaterMuch)</td>
                                <td>@(item?.WaterPrice)</td>
                                <td>@(item?.TotalWaterPrice)</td>
                                <td>@(item?.LateFee)</td>
                                <td>@(item?.TotalPrice)</td>
                                <td>@(((ChargeInfo.StateEnum)item.State).ToDescription())</td>
                                @*<td>10</td>
                                    <td>111</td>
                                    <td>222</td>*@
                                <td>@(item.ManagerInfo?.UserName)</td>
                                <td>@(item?.ColectMoneyDate?.ToString("yyyy/MM/dd"))</td>
                                <td>@(item.Customer.EmployeeInfo.NAME)</td>
                                <td>@(item.ThisTime)</td>
                            </tr>
                        }


                    }

                </tbody>

            </table>
            <div class="pagin">
                @if (pmodel != null)
                {
                    <div class="message">共<i class="blue">@(pmodel?.TotalItemCount)</i>条记录，共&nbsp;<i class="blue">@(pmodel?.TotalPageCount)&nbsp;</i>页</div> 
                    @Html.Pager(pmodel, BaseController.PagerOptions) 
                }



            </div>




        </div>
    </body>

</html>
